<template>
  <div class="nav-common flexbox flexbox-middle">
    <i class="logo"></i>
    <div class="flexchild"></div>
    <div @click="handlepop" class="icon-menu" :class="{'close-icon': show}"></div>

    <div v-show="show" @click="show = false" class="pop-alert">
        <ul class="menu-list">
          <li class="menu-item flexbox flexbox-middle" @click="jump(item)" v-for="item in menuList" :key="item.value">
             <span class="flexchild">{{item.name}}</span>
             <i class="more-icon"></i>
          </li>
        </ul>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
        show: false,
        menuList: [
          {
            name: '首页',
            url: '/',
            value: 0
          },
          {
            name: '关于我们',
            url: '/about',
            value: 1
          },
          {
            name: '用户协议',
            url: 'https://employeecard.easyctid.cn/h5#/pages/agreement/index',
            value: 2
          }/*,
          {
            name: '产品报价',
            url: '/offer',
            value: 3
          }*/
        ]
    };
  },
  methods: {
    jump(item) {
      this.show = false
      if(item.value == 2) {
        window.location.href = item.url
      } else {
        this.$router.push(item.url).catch(()=>{})
      }
    },
    handlepop() {
      this.show = !this.show
    }
  },
};
</script>

<style scoped lang='less'>
.nav-common {
  position: fixed;
  width: 100%;
  height: 88px;
  left: 0;
  top: 0;
  z-index: 99;
  padding: 0 40px;
  background-color: #FFFFFF;
  box-sizing: border-box;
  .logo {
    display: block;
    width: 217px;
    height: 50px;
    background: url("../../assets/img/logo-kx.png") no-repeat center;
    background-size: 100% 100%;
  }
  .icon-menu {
    width: 44px;
    height: 44px;
    background: url("../../assets/img/icon-menu.png") no-repeat center;
    background-size: 100% 100%;
    &.close-icon {
      background: url("../../assets/img/icon-menu-close.png") no-repeat center;
      background-size: 100% 100%;
    }
  }
}
.pop-alert {
  position: fixed;
  left: 0;
  top: 88px;
  bottom: 0;
  width: 100%;
  z-index: 99;
  background-color: rgba(0,0,0, 0.7);
}
.menu-list {
  background-color: #FFFFFF;
  padding: 0 32px 0 32px;
  border-radius: 0 0 20px 20px;
  .more-icon {
     display: block;
     width: 32px;
     height: 32px;
     background: url("../../assets/img/icon-more.png") no-repeat center;
     background-size: 100% 100%;
  }
  .menu-item {
    height: 100px;
    font-size: 30px;
    color: #222222;
  }
}
</style>
